package com.example.demo;

import com.example.cdtutils.RegexUtils;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MyRegx {
//    // 未来动力二维码适配
//    public static String qrCode = "http://wldl.quantongnet.com/CDZWeb//" +
//            "findGunDetailChargingStationAction.action?devId=3730&ConnectorID=5101070002000001|1" +
//            "&code=DevCode3730";
//    public static String qrcodeRule = "http://wldl.quantongnet.com/CDZWeb//findGunDetailChargingStationAction.action";
//
//    public static Pattern p1 = Pattern.compile("^" + qrcodeRule + "\\?devId=([0-9]+)&ConnectorID=([0-9]+\\|[0-9]+)&code=[0-9a-zA-Z]+$");
//
//    public static void main(String[] args) {
//        Matcher m1 = p1.matcher(qrCode);
//        System.out.println(m1.find());
//        System.out.println(m1.group(2));
//    }

    // 通用二维码适配冒号和竖线，竖线在中括号里不用转义
    public static String qrCode = "hlht://6101120026:0006|182.MA6UWY8G4";
    public static Pattern p1 = Pattern.compile("^hlht://(([\\w:|-]{1,26})\\.)([\\w]{9})$");


    /*
     *   和瑞众联
     *   https://test.bjecpower.com/wx/index.html#/jumpCode?type=22_2_32becie892bacd3_DB09018AX12B
     *   22 类型
     *   2 公司
     *   32becie892bacd3 站ID
     *   DB09018AX12B 枪号
     */


    public static void main(String[] args) {
        Matcher matcher = p1.matcher(qrCode);
        System.out.println(matcher.matches());
        System.out.println(matcher.group(0));
        System.out.println(matcher.group(1));
        System.out.println(matcher.group(2));
        System.out.println(matcher.group(3));
    }
}
